import request from '@/utils/request'
import { parseStrEmpty } from "@/utils/ruoyi";

// 查询动态列表
export function listDynamic(data) {
  return request({
    url: '/dynamic/dynamic/dynamicList',
    method: 'post',
    data: data
  })
}

// 查询动态详细
export function getDynamic(dynamicId) {
  return request({
    url: '/dynamic/dynamic/' + parseStrEmpty(dynamicId),
    method: 'get'
  })
}

// 新增动态
export function addDynamic(data) {
  return request({
    url: '/dynamic/dynamic',
    method: 'post',
    data: data
  })
}

// 修改动态
export function updateDynamic(data) {
  return request({
    url: '/dynamic/dynamic',
    method: 'put',
    data: data
  })
}

// 删除动态
export function delDynamic(dynamicId) {
  return request({
    url: '/dynamic/dynamic/' + dynamicId,
    method: 'delete'
  })
}

// 动态审核状态修改
export function changeDynamicStatus(dynamicIds, status) {
  const data = {
    dynamicIds,
    status
  }
  return request({
    url: '/dynamic/dynamic/dynamicChangeStatus',
    method: 'post',
    data: data
  })
}

// 动态上架状态修改
export function changeDynamicActive(dynamicId, active) {
  const data = {
    dynamicId,
    active
  }
  return request({
    url: '/dynamic/dynamic/dynamicChangeActive',
    method: 'put',
    data: data
  })
}
